{extend name="public/base" /}
{block name="head"}
{/block}
{block name="body"}
<div class="page-content" id="page-content">
<!--   <div class="top-content">
    <div class="page-title">
      <h5>筛选条件</h5>
    </div>
    <div class="search-box"></div>
  </div> -->
  <div class="main-content">
    <div class="page-title">
      <h5>分类列表</h5>
      <a href="{:Url('create')}" class="layui-btn layui-btn-small layui-btn-normal create-but">添加分类</a>
    </div>

    <div class="layui-form">
      <table class="layui-table layui-form">
        <thead>
          <tr>
            <th width="6%">id</th>
            <th width="15%">分类名字</th>
            <th width="8%">操作</th>
          </tr> 
        </thead>
        <tbody>
          {volist name="categoryList" id="vo"}
            <tr data-id="{$vo.id}">
              <td>{$vo.id}</td>
              <td class="category_name">{$vo.category_name}</td>
              <td>
                <div class="layui-btn-group">
                  <a class="layui-btn layui-btn-small" href="{:Url('create',['parent_id'=>$vo['id']])}">添加子分类</a>
                  <a class="layui-btn layui-btn-normal layui-btn-small" href="{:Url('update',['id'=>$vo['id']])}">编辑</a>
                  <button class="layui-btn fuyun-btn-del layui-btn-small btn-del-id" data-url="{:Url('deleteAll')}" data-confirm="确定删除该商品吗？" data-successtip="删除成功！" data-id="<?=$vo['id']?>" ><i class="fa fa-close margin-right-5"></i>删除</button>
                </div>
              </td>
            </tr>
          {/volist}
        </tbody>
      </table>
    </div>
  </div>
</div>


<script type="text/javascript">
  layui.use([ 'layer','form'], function(){
    var layer = layui.layer;
    var form = layui.form();
    //全选
    form.on('checkbox(allChoose)', function(data){
        var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
        child.each(function(index, item){
            item.checked = data.elem.checked;
        });
        form.render('checkbox');
    });
  });

  fuyun.components(['page'],{
    el:"#page-content",
    data:{
      labelPosition: 'top',
    },
  });

</script>

{/block}
